package com.web.kftsdk.api;


import com.web.kftsdk.common.api.BasePayConfigStorage;
import com.web.kftsdk.common.util.str.StringUtils;

import javax.annotation.PostConstruct;

/**
 * 微信配置存储
 *
 * @author xukk
 */
public class KftPayConfigStorage extends BasePayConfigStorage {

    /**
     * 应用id
     */
    private String appId;

    private String sftpUsername="2018072300096619";
    private String sftpPassword="admin1234";
    private String sftpHost="218.17.35.123";
    private Integer sftpPort = 22;
    private String sftpPath="/sharedata/2018072300096619";
    private String packPath;
    private String version;
    private String language;

    public String getSftpUsername() {
        return sftpUsername;
    }

    public void setSftpUsername(String sftpUsername) {
        this.sftpUsername = sftpUsername;
    }

    public String getSftpPassword() {
        return sftpPassword;
    }

    public void setSftpPassword(String sftpPassword) {
        this.sftpPassword = sftpPassword;
    }

    public String getSftpHost() {
        return sftpHost;
    }

    public void setSftpHost(String sftpHost) {
        this.sftpHost = sftpHost;
    }

    public Integer getSftpPort() {
        return sftpPort;
    }

    public void setSftpPort(Integer sftpPort) {
        this.sftpPort = sftpPort;
    }

    public String getSftpPath() {
        return sftpPath;
    }

    public void setSftpPath(String sftpPath) {
        this.sftpPath = sftpPath;
    }

    public String getPackPath() {
        return packPath;
    }

    public void setPackPath(String packPath) {
        this.packPath = packPath;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    /**
     * apiclient_cert.p12文件的绝对路径，或者如果放在项目中，请以classpath:开头指定
     */
    private String keyPath;

    @Override
    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }


    public String getKeyPath() {
        return keyPath;
    }

    public void setKeyPath(String keyPath) {
        this.keyPath = keyPath;
    }

    @Override
    public String getPid() {
        return null;
    }

    @Override
    public String getSeller() {
        return null;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @PostConstruct
    public void init(){
        if(StringUtils.isBlank(this.getProdGateWay())){
            this.setProdGateWay("https://merchant.kftpay.com.cn:8443/gateway/nonbatch");
        }
        if(StringUtils.isBlank(this.getDevGateWay())){
            this.setDevGateWay("https://218.17.35.123:6443/gateway/nonbatch");
        }
        if(this.isTest()){
            this.version="1.0.0-IEST";
            this.setGateWay(this.getDevGateWay());
        }else{
            this.version="1.0.0-PRD";
            this.setGateWay(this.getProdGateWay());
        }
        if(StringUtils.isBlank(this.getInputCharset())){
            this.setInputCharset("utf-8");
        }
        if(StringUtils.isBlank(this.getSignType())){
            this.setSignType("RSA");
        }
        if(StringUtils.isBlank(this.getLanguage())){
            this.language="zh_CN";
        }
    }
}
